﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;

namespace Katana.DataAccess
{
    public partial class Lid
    {
        #region Members

        protected EntitySet<Rol> m_Rollen;

        #endregion

        #region Properties

        public IQueryable<Rol> Rollen
        {
            get
            {
                m_Rollen = new EntitySet<Rol>(onAddRol, onRemoveRol);

                var rollen = from r in KatanaContext.Context.Rols
                            join lr in KatanaContext.Context.Lid_Rols on r.RolID equals lr.RolID
                            where lr.LidID == this.LidID
                            select r;

                foreach (var l in rollen)
                {
                    m_Rollen.Add(l);
                }

                return rollen;
            }
        }

        #endregion

        #region Properted methods

        protected void onAddRol(Rol rol)
        {
        }

        protected void onRemoveRol(Rol rol)
        {
        }

        #endregion
    }
}
